Skip to main content

pascal

pascal(input: Integer) : any[]

param input - the size of the pascal matrix, an Integer, positive and not zero

returns: any[] - the pascal matrix corresponding to the size given for the square matrix.

A pascal matrix has binomial coefficients as its entrie put simply. Recall that the binomial coefficients are the numbers in front of the variables for the expansion (a+b)^x. SoFor x = 2, (a+b)^2 = (a+b)(a+b) = a^2+2ab+b^2 = (1)a^2 + (2)ab + (1)b^2. Thus the coefficients for the case x = 2 is 1,2,1. This function takes in a numberm, the size of the matrix, and returns the pascal matrix coorresponding to that size, as a square matrix.